package com.bailiban.entity;


import com.bailiban.DateUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * (Orders)实体类
 *
 * @author zhulang
 * @since 2020-10-27 11:06:14
 */
public class Orders implements Serializable {
    private static final long serialVersionUID = 878451948308949227L;

    private Integer id;
    /**
     * 订单编号
     */
    private String ordernum;
    private Product product;
    private Member member;
    private List<Traveller> travellerList;

    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public List<Traveller> getTravellerList() {
        return travellerList;
    }

    public void setTravellerList(List<Traveller> travellerList) {
        this.travellerList = travellerList;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    /**
     * 下单时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date ordertime;
    private String ordertimeStr;

    public String getOrdertimeStr() {
        if (this.ordertime != null) {
            String s = DateUtils.date2String(this.ordertime, "yyyy-MM-dd HH:mm:ss");
            this.ordertimeStr = s;
        }
        return ordertimeStr;
    }

    public void setOrdertimeStr(String ordertimeStr) {
        this.ordertimeStr = ordertimeStr;
    }

    /**
     * 出行人数
     */
    private Integer peoplecount;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOrdernum() {
        return ordernum;
    }

    public void setOrdernum(String ordernum) {
        this.ordernum = ordernum;
    }

    public Date getOrdertime() {
        return ordertime;
    }

    public void setOrdertime(Date ordertime) {
        this.ordertime = ordertime;
    }

    public Integer getPeoplecount() {
        return peoplecount;
    }

    public void setPeoplecount(Integer peoplecount) {
        this.peoplecount = peoplecount;
    }

    public String getOrderdesc() {
        return orderdesc;
    }

    public void setOrderdesc(String orderdesc) {
        this.orderdesc = orderdesc;
    }

    public Integer getPaytype() {
        return paytype;
    }

    public void setPaytype(Integer paytype) {
        this.paytype = paytype;
    }

    public String getPaytypeStr() {
//        支付方式（ 0 支付宝 1 微信 2 其它）
        if (this.paytype == 0) {
            this.paytypeStr = "支付宝";
        } else if (this.paytype == 1) {
            this.paytypeStr = "微信";
        } else {
            this.paytypeStr = "其它";
        }
        return paytypeStr;
    }

    public void setPaytypeStr(String paytypeStr) {
        this.paytypeStr = paytypeStr;
    }

    public Integer getOrderstatus() {
        return orderstatus;
    }

    public void setOrderstatus(Integer orderstatus) {
        this.orderstatus = orderstatus;
    }

    public String getOrderstatusStr() {
//        订单状态(0 未支付 1 已支付)
        if (this.orderstatus == 0) {
            this.orderstatusStr = "未支付";
        } else if (this.orderstatus == 1) {
            this.orderstatusStr = "已支付";
        } else {
            this.orderstatusStr = "未知状态";
        }
        return orderstatusStr;
    }

    public void setOrderstatusStr(String orderstatusStr) {
        this.orderstatusStr = orderstatusStr;
    }

    public Integer getProductid() {
        return productid;
    }

    public void setProductid(Integer productid) {
        this.productid = productid;
    }

    public Integer getMemberid() {
        return memberid;
    }

    public void setMemberid(Integer memberid) {
        this.memberid = memberid;
    }

    /**
     * 订单描述（其它信息）
     */
    private String orderdesc;
    /**
     * 支付方式（ 0 支付宝 1 微信 2 其它）
     */
    private Integer paytype;
    private String paytypeStr;
    /**
     * 订单状态(0 未支付 1 已支付)
     */
    private Integer orderstatus;
    private String orderstatusStr;
    /**
     * 产品id 外键
     */
    private Integer productid;
    /**
     * 会员（联系人）id 外键
     */
    private Integer memberid;

}